<?php
/**
 * Created by PhpStorm
 * Author: 沁塵
 * Date: 2020/9/5
 * Time: 6:09 下午
 */

namespace app\api\service;



use app\api\model\LiveGenbo;

class LiveService
{
    /*
     *
     * 判断当前订单的最终出单渠道
     * */
    public function lastQd($type,$chudqd)
    {

        if ($type == "短视频") {
            return "视频";
        }else{
            // 直播类型
            // 如果出单渠道是短视频 则返回短视频 其他都是直播
            if($chudqd == "视频"){
                return "视频";
            }else{
                return "直播";
            }
        }
    }

    /*
     * 对当前跟播任务id的task进行启用 别的相同计划不启用
     * */
    public function genboTaskRun($task_id)
    {
        $genbo_task = LiveGenbo::where('id',$task_id)->find();
        LiveGenbo::where('task_name',$genbo_task['task_name'])->where('id','<>',$task_id)->update([
            "is_run" => 0
        ]);
        $genbo_task->is_run = 1;
        $genbo_task->save();
    }
}